//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Eas.WebCrawler.Test.Model {
    /// <summary>
    /// Summary description for WorkerContextTest
    /// </summary>
    [TestClass]
    public class WorkerContextTest {
        public WorkerContextTest() {
            //
            // TODO: Add constructor logic here
            //
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        /// <summary>Executes the TestSimplePropterties test.</summary>
        public void TestSimplePropterties() {
            TestSettings settings = new TestSettings();
            string[] startingUris = new string[] { "http://www.google.com", "http://www.msn.com" };
            settings.StartingUris = startingUris;
            Eas.WebCrawler.Model.Events.BaseWebCrawlerEvents events = new Eas.WebCrawler.Model.Events.BaseWebCrawlerEvents();
            Eas.WebCrawler.Model.Core.BaseRequestStore store = new Eas.WebCrawler.Model.Core.BaseRequestStore();


            Eas.WebCrawler.Model.Actions.ActionFactory factory = new Eas.WebCrawler.Model.Actions.BaseActionFactory();
            Eas.WebCrawler.Model.Gateway.WebGateway gateway = new Eas.WebCrawler.Model.Gateway.BaseWebGateway();
            Eas.WebCrawler.Model.StateTrackers.StateTracker tracker = new Eas.WebCrawler.Model.StateTrackers.BaseStateTracker();
            Eas.WebCrawler.Model.Core.BaseWebCrawlerContext crawlerContext = new Eas.WebCrawler.Model.Core.BaseWebCrawlerContext(settings, store, events);
            using (Eas.WebCrawler.Model.Core.WorkerContext context = new Eas.WebCrawler.Model.Core.WorkerContext(crawlerContext, factory, events, gateway, events, tracker)) {
                Assert.AreSame(factory, context.ActionFactory);
                Assert.AreSame(gateway, context.WebGateway);
                Assert.AreSame(tracker, context.StateTracker);
                Assert.AreSame(events, context.EventReporter);
                Assert.AreSame(events, context.Events);
                Assert.AreSame(crawlerContext, context.WebCrawlerContext);
            }
        }

    }
}
